Skip to content

feat(transport): add single handshake flight option - #4401

Open
mxinden wants to merge 1 commit into
mozilla:mainfrom
mxinden-bot:single-flight
Open

mxinden wants to merge 1 commit into
mozilla:mainfrom
mxinden-bot:single-flight

Conversation

@mxinden

@mxinden mxinden commented Nov 21, 2026

Copy link
Copy Markdown
Member

Add ConnectionParameters::single_handshake_flight. When enabled, a client that gets no response at all (no Initial, Retry or Version Negotiation) to its first handshake flight closes the connection at the first PTO with Error::NoHandshakeResponse, instead of sending probes.

This allows to experiment with optimistic QUIC in Firefox: attempting HTTP/3 against a server that is not known to support it (no Alt-Svc, no HTTPS DNS record), racing it alongside TCP at the cost of a single flight. A missing response most likely means no QUIC support, so retransmitting only wastes resources.

A Version Negotiation response disables the option for the restarted connection, since the server evidently speaks QUIC.

@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.62%. Comparing base (662ec9f) to head (da79bdc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4401      +/-   ##
==========================================
- Coverage   96.74%   96.62%   -0.12%     
==========================================
  Files         113      118       +5     
  Lines       43493    43918     +425     
  Branches    43493    43918     +425     
==========================================
+ Hits        42076    42436     +360     
- Misses       1405     1461      +56     
- Partials       12       21       +9     
Flag Coverage Δ
freebsd 94.13% <97.29%> (-0.10%) ⬇️
linux 96.78% <100.00%> (+<0.01%) ⬆️
macos 94.50% <97.29%> (-0.01%) ⬇️
windows 94.58% <97.29%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
neqo-common 99.33% <ø> (ø)
neqo-http3 96.00% <ø> (ø)
neqo-qpack 96.55% <ø> (ø)
neqo-transport 97.13% <100.00%> (+<0.01%) ⬆️
neqo-udp 87.63% <ø> (ø)
mtu 91.31% <ø> (ø)

@mxinden
mxinden marked this pull request as ready for review November 21, 2026 09:09
Copilot AI balanced review requested due to automatic review settings November 21, 2026 09:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Tests do not cover Retry and Version Negotiation with single_handshake_flight enabled, leaving valid-response PTO probing and rejected or ignored-response early-close behavior unverified.

2 open issues
What changed in this PR

Adds an opt-in single-handshake-flight mode to Neqo’s QUIC transport, supporting Firefox experiments that race HTTP/3 against TCP when QUIC support is unknown.

Changes:

  • Closes unanswered client handshakes at the first probe timeout with NoHandshakeResponse, without sending probes.
  • Preserves retransmission after a server response, including disabling the option after Version Negotiation.
  • Adds tests for unanswered flights, Initial responses, and successful handshakes.
File Description
neqo-transport/​src/​recovery/​mod.rs Reports whether the probe timeout fired.
neqo-transport/​src/​lib.rs Adds NoHandshakeResponse and tests its error-code mapping.
neqo-transport/​src/​connection/​tests/​handshake.rs Tests early closure and normal handshake behavior.
neqo-transport/​src/​connection/​params.rs Adds and documents the default-disabled option.
neqo-transport/​src/​connection/​mod.rs Implements early closure and the Version Negotiation reset.

Review effort: Balanced

&& self.conn_params.single_handshake_flight_enabled()
&& self.role == Role::Client
&& self.state == State::WaitInitial
&& !matches!(self.address_validation, AddressValidationInfo::Retry { .. })
.versions(version, self.conn_params.get_versions().all().to_vec());
.versions(version, self.conn_params.get_versions().all().to_vec())
// The server responded, so it speaks QUIC: no reason to give up early.
.single_handshake_flight(false);
@github-actions

Copy link
Copy Markdown
Contributor

Client/server transfer results

Performance differences relative to 662ec9f.

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server Mean±σ Min–Max Median±MAD MiB/s±σ ΔMedian
google-neqo-cubic 80.3 ± 0.5 79.2 – 81.4 80.3 ± 0.5 398.7 ± 2.3 💔 +1.0 (+1.2%)
neqo-neqo-newreno-nopacing 23.9 ± 0.2 23.6 – 24.5 23.9 ± 0.1 1337.3 ± 10.5 💔 +0.6 (+2.4%)

Table above only shows statistically significant changes. See all results below.

All results

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server Mean±σ Min–Max Median±MAD MiB/s±σ ΔMedian
google-google 155.2 ± 0.6 154.0 – 156.9 155.1 ± 0.7 206.2 ± 0.7
google-neqo-cubic 80.3 ± 0.5 79.2 – 81.4 80.3 ± 0.5 398.7 ± 2.3 💔 +1.0 (+1.2%)
neqo-google-cubic 248.7 ± 40.1 201.4 – 322.1 246.3 ± 58.2 128.7 ± 20.7 -1.9 (-0.7%)
neqo-neqo-cubic 23.9 ± 0.2 23.5 – 24.6 23.8 ± 0.2 1340.8 ± 11.3 -0.0 (-0.2%)
neqo-neqo-cubic-nopacing 23.4 ± 0.2 23.1 – 23.9 23.3 ± 0.1 1369.3 ± 9.7 -0.0 (-0.2%)
neqo-neqo-newreno 24.0 ± 0.2 23.6 – 24.7 24.0 ± 0.2 1332.7 ± 11.6 +0.2 (+0.9%)
neqo-neqo-newreno-nopacing 23.9 ± 0.2 23.6 – 24.5 23.9 ± 0.1 1337.3 ± 10.5 💔 +0.6 (+2.4%)
neqo-quiche-cubic 35.4 ± 0.3 35.0 – 36.2 35.4 ± 0.2 903.2 ± 6.5 +0.0 (+0.1%)
neqo-s2n-cubic 45.3 ± 0.2 44.8 – 45.8 45.3 ± 0.2 706.5 ± 3.4 +0.1 (+0.1%)
quiche-neqo-cubic 36.5 ± 0.5 35.4 – 37.6 36.5 ± 0.5 876.0 ± 11.1 -0.0 (-0.1%)
quiche-quiche 42.8 ± 0.3 42.1 – 43.8 42.8 ± 0.2 747.8 ± 4.4
s2n-neqo-cubic 126.4 ± 0.6 125.0 – 128.3 126.3 ± 0.6 253.2 ± 1.3 +0.1 (+0.1%)
s2n-s2n ⚠️ 172.5 ± 20.3 146.0 – 269.7 169.4 ± 1.3 185.5 ± 21.9

Download data for profiler.firefox.com or download performance comparison data.

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark results

No significant performance differences relative to 662ec9f.

All results
transfer/1-conn/1-100mb-req (aka. Upload)/mtu-1500
       time:   [61.089 ms 61.124 ms 61.162 ms]
       thrpt:  [1.5967 GiB/s 1.5977 GiB/s 1.5986 GiB/s]
Found 3 outliers among 100 measurements (3.00%)
2 (2.00%) high mild
1 (1.00%) high severe
transfer/1-conn/1-100mb-resp (aka. Download)/mtu-1500
       time:   [60.573 ms 60.621 ms 60.668 ms]
       thrpt:  [1.6097 GiB/s 1.6109 GiB/s 1.6122 GiB/s]
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
transfer/1-conn/1-1b-resp (aka. HPS)/mtu-1500
       time:   [3.8177 ms 3.8188 ms 3.8199 ms]
       thrpt:  [261.79   B/s 261.86   B/s 261.94   B/s]
Found 4 outliers among 100 measurements (4.00%)
2 (2.00%) low mild
2 (2.00%) high mild
transfer/1-conn/10_000-parallel-1b-resp (aka. RPS)/mtu-1500
       time:   [88.011 ms 88.158 ms 88.303 ms]
       thrpt:  [113.25 Kelem/s 113.43 Kelem/s 113.62 Kelem/s]
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) low mild
streams-flow-controlled/walltime/1-streams/each-4194304-bytes
       time:   [12.894 ms 12.901 ms 12.908 ms]
       thrpt:  [309.88 MiB/s 310.06 MiB/s 310.23 MiB/s]
Found 3 outliers among 100 measurements (3.00%)
3 (3.00%) high mild
streams-flow-controlled/walltime/10-streams/each-1048576-bytes
       time:   [35.600 ms 35.615 ms 35.630 ms]
       thrpt:  [280.66 MiB/s 280.78 MiB/s 280.90 MiB/s]
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
streams/walltime/1-streams/each-1000-bytes
       time:   [160.19 µs 160.88 µs 161.74 µs]
       thrpt:  [5.8963 MiB/s 5.9280 MiB/s 5.9532 MiB/s]
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
streams/walltime/1000-streams/each-1-bytes
       time:   [4.7246 ms 4.7276 ms 4.7308 ms]
       thrpt:  [206.43 KiB/s 206.57 KiB/s 206.70 KiB/s]
Found 7 outliers among 100 measurements (7.00%)
1 (1.00%) low mild
5 (5.00%) high mild
1 (1.00%) high severe
streams/walltime/1000-streams/each-1000-bytes
       time:   [15.068 ms 15.078 ms 15.089 ms]
       thrpt:  [63.203 MiB/s 63.249 MiB/s 63.293 MiB/s]
transfer/walltime/pacing-false/same-seed
       time:   [3.4410 ms 3.4422 ms 3.4437 ms]
       thrpt:  [1.1343 GiB/s 1.1348 GiB/s 1.1352 GiB/s]
transfer/walltime/pacing-false/varying-seeds
       time:   [3.4429 ms 3.4440 ms 3.4455 ms]
       thrpt:  [1.1337 GiB/s 1.1342 GiB/s 1.1346 GiB/s]
transfer/walltime/pacing-true/same-seed
       time:   [3.9766 ms 3.9847 ms 3.9914 ms]
       thrpt:  [1002.1 MiB/s 1003.8 MiB/s 1005.9 MiB/s]
transfer/walltime/pacing-true/varying-seeds
       time:   [4.0188 ms 4.0213 ms 4.0244 ms]
       thrpt:  [993.94 MiB/s 994.71 MiB/s 995.32 MiB/s]
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild

Instructions per cycle

Criterion reported no significant timing changes.

All benchmarks
Benchmark IPC before IPC after ΔIPC
transfer/1-conn/1-100mb-resp (aka. Download)/mtu-1500 3.08 3.13 +1.5%
transfer/1-conn/10_000-parallel-1b-resp (aka. RPS)/mtu-1500 3.22 3.18 -1.2%
streams-flow-controlled/walltime/1-streams/each-4194304-bytes 2.96 2.99 +0.9%
transfer/1-conn/1-100mb-req (aka. Upload)/mtu-1500 3.08 3.05 -0.8%
streams/walltime/1000-streams/each-1000-bytes 2.95 2.97 +0.8%
transfer/walltime/pacing-false/varying-seeds 2.86 2.88 +0.6%
streams-flow-controlled/walltime/10-streams/each-1048576-bytes 3.12 3.13 +0.4%
streams/walltime/1000-streams/each-1-bytes 3.26 3.27 +0.3%
transfer/walltime/pacing-true/varying-seeds 2.89 2.88 -0.2%
streams/walltime/1-streams/each-1000-bytes 2.59 2.60 +0.2%
transfer/1-conn/1-1b-resp (aka. HPS)/mtu-1500 2.25 2.25 -0.1%
transfer/walltime/pacing-true/same-seed 2.87 2.87 -0.0%
transfer/walltime/pacing-false/same-seed 2.87 2.87 -0.0%
Profiles for profiler.firefox.com (64)

Download data for profiler.firefox.com or download performance comparison data.

@codspeed

codspeed Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will regress 2 benchmarks

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚡ 6 improved benchmarks
❌ 2 regressed benchmarks
✅ 93 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Walltime quiche-neqo 45 ms 47.4 ms -5.02%
❌ Walltime 1-conn/1-100mb-resp (aka. Download) 58.9 ms 60.7 ms -2.91%
⚡ Walltime 1-conn/10_000-parallel-1b-resp (aka. RPS) 88.1 ms 84 ms +4.93%
⚡ Walltime walltime/pacing-false/same-seed 3.6 ms 3.4 ms +4.73%
⚡ Walltime walltime/pacing-false/varying-seeds 3.3 ms 3.2 ms +3.1%
⚡ Walltime walltime/1000-streams/each-1000-bytes 15.4 ms 15 ms +2.77%
⚡ Walltime walltime/10-streams/each-1048576-bytes 36.1 ms 35.3 ms +2.2%
⚡ Walltime walltime/1000-streams/each-1-bytes 4.8 ms 4.7 ms +2.02%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mxinden-bot:single-flight (da79bdc) with main (662ec9f)

Open in CodSpeed

mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When enabled and nothing signals
that the origin supports HTTP/3 (no alt-svc entries, and no HTTPS
service information has arrived), make one HTTP/3 attempt to the first
origin address of the preferred family. A pending HTTPS query, e.g. a
slow or timed out one, does not prevent the attempt.

The attempt starts right before the first regular attempt and does not
delay the regular attempts, so it races alongside TCP without slowing
it down. The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When enabled and nothing signals
that the origin supports HTTP/3 (no alt-svc entries, and no HTTPS
service information has arrived), make one HTTP/3 attempt to the first
origin address of the preferred family. A pending HTTPS query, e.g. a
slow or timed out one, does not prevent the attempt.

The attempt starts right before the first regular attempt and does not
delay the regular attempts, so it races alongside TCP without slowing
it down. The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When enabled and nothing signals
that the origin supports HTTP/3 (no alt-svc entries, and no HTTPS
service information has arrived), make one HTTP/3 attempt to the first
origin address of the preferred family. A pending HTTPS query, e.g. a
slow or timed out one, does not prevent the attempt.

The attempt starts right before the first regular attempt and does not
delay the regular attempts, so it races alongside TCP without slowing
it down. The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When enabled and nothing signals
that the origin supports HTTP/3 (no alt-svc entries, and no HTTPS record
advertising h3), make one HTTP/3 attempt to the first origin address of
the preferred family. An HTTPS record with only other protocols, e.g.
alpn=h2, or a pending HTTPS query, e.g. a slow or timed out one, does
not prevent the attempt. An HTTPS record with an ECH config does, as the
attempt does not use ECH and would expose the server name.

The attempt starts right before the first regular attempt and does not
delay the regular attempts, so it races alongside TCP without slowing
it down. The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. With it, HTTP/3 is always tried.
An alt-svc entry or HTTPS record that advertises HTTP/3 leads to regular
HTTP/3 attempts as before. Without such a signal, make one optimistic
HTTP/3 attempt to the first origin address of the preferred family,
running in parallel with the regular attempts. An alt-svc entry or HTTPS
record with only other protocols, e.g. h2, or a pending HTTPS query,
e.g. a slow or timed out one, is no signal.

The optimistic attempt uses the ECH config of an HTTPS record for the
origin. When only HTTPS records for other targets carry an ECH config,
there is no optimistic attempt, as it would have to go without ECH and
expose the server name.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. With it, HTTP/3 is always tried.
An alt-svc entry or HTTPS record that advertises HTTP/3 leads to regular
HTTP/3 attempts as before. Without such a signal, make one optimistic
HTTP/3 attempt to the first origin address of the preferred family,
running in parallel with the regular attempts. An alt-svc entry or HTTPS
record with only other protocols, e.g. h2, or a pending HTTPS query,
e.g. a slow or timed out one, is no signal.

The optimistic attempt uses the ECH config of an HTTPS record for the
origin. When only HTTPS records for other targets carry an ECH config,
there is no optimistic attempt, as it would have to go without ECH and
expose the server name.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. With it, HTTP/3 is always tried.
An alt-svc entry or HTTPS record that advertises HTTP/3 leads to regular
HTTP/3 attempts as before. Without such a signal, make one optimistic
HTTP/3 attempt to the first origin address of the preferred family,
running in parallel with the regular attempts. An alt-svc entry or HTTPS
record with only other protocols, e.g. h2, or a pending HTTPS query,
e.g. a slow or timed out one, is no signal.

The optimistic attempt uses the ECH config of an HTTPS record for the
origin. When only HTTPS records for other targets carry an ECH config,
there is no optimistic attempt, as it would have to go without ECH and
expose the server name.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When nothing is known about the
protocols the origin supports, i.e. there is no alt-svc entry and no
positive HTTPS record, make one optimistic HTTP/3 attempt to the first
origin address of the preferred family, running in parallel with the
regular attempts. A pending or failed HTTPS query, e.g. a slow or timed
out one, does not prevent the attempt.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When nothing is known about the
protocols the origin supports, i.e. there is no alt-svc entry and no
positive HTTPS record, make one optimistic HTTP/3 attempt to the first
origin address of the preferred family, running in parallel with the
regular attempts. A pending or failed HTTPS query, e.g. a slow or timed
out one, does not prevent the attempt.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When nothing is known about the
protocols the origin supports, i.e. there is no alt-svc entry and no
positive HTTPS record, make one optimistic HTTP/3 attempt to the first
origin address of the preferred family, running in parallel with the
regular attempts. A pending or failed HTTPS query, e.g. a slow or timed
out one, does not prevent the attempt.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When nothing is known about the
protocols the origin supports, i.e. there is no alt-svc entry and no
positive HTTPS record, make one optimistic HTTP/3 attempt to the first
origin address of the preferred family, running in parallel with the
regular attempts. A pending or failed HTTPS query, e.g. a slow or timed
out one, does not prevent the attempt.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When nothing is known about the
protocols the origin supports, i.e. there is no alt-svc entry and no
positive HTTPS record, make one optimistic HTTP/3 attempt to the first
origin address of the preferred family, running in parallel with the
regular attempts. A pending or failed HTTPS query, e.g. a slow or timed
out one, does not prevent the attempt.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

If an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address waits, with or
without ECH, so there is no second QUIC connection to that address. If
the optimistic attempt fails, that endpoint is attempted normally.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When nothing is known about the
protocols the origin supports, i.e. there is no alt-svc entry and no
positive HTTPS record, make one optimistic HTTP/3 attempt to the first
origin address of the preferred family, running in parallel with the
regular attempts. A pending or failed HTTPS query, e.g. a slow or timed
out one, does not prevent the attempt.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

The optimistic attempt does not count as an attempt of its endpoint. If
an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address is attempted
normally, in parallel.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
mxinden-bot pushed a commit to mxinden-bot/happy-eyeballs that referenced this pull request Nov 21, 2026
Add `NetworkConfig::optimistic_quic`. When nothing is known about the
protocols the origin supports, i.e. there is no alt-svc entry and no
positive HTTPS record, make one optimistic HTTP/3 attempt to the first
origin address of the preferred family, running in parallel with the
regular attempts. A pending or failed HTTPS query, e.g. a slow or timed
out one, does not prevent the attempt.

The new `optimistic` field on `Output::AttemptConnection` (and
`ConnectionAttempt`) marks the attempt. The caller should send only a
single QUIC handshake flight for it, e.g. with neqo's
`ConnectionParameters::single_handshake_flight`, see
mozilla/neqo#4401.

The optimistic attempt does not count as an attempt of its endpoint. If
an HTTPS record with h3 arrives while the optimistic attempt is in
progress, its HTTP/3 endpoint to the same address is attempted
normally, in parallel.

This allows to experiment with optimistic QUIC in Firefox.

Adding the field is a breaking API change.
Add `ConnectionParameters::single_handshake_flight`. When enabled, a
client that gets no response at all (no Initial, Retry or Version
Negotiation) to its first handshake flight closes the connection at
the first PTO with `Error::NoHandshakeResponse`, instead of sending
probes.

This allows to experiment with optimistic QUIC in Firefox: attempting
HTTP/3 against a server that is not known to support it (no Alt-Svc, no
HTTPS DNS record), racing it alongside TCP at the cost of a single
flight. A missing response most likely means no QUIC support, so
retransmitting only wastes resources.

A Version Negotiation response disables the option for the restarted
connection, since the server evidently speaks QUIC.
mxinden-bot pushed a commit to mxinden-bot/firefox that referenced this pull request Nov 21, 2026
Behind network.http.http3.optimistic_quic (default true), Happy
Eyeballs races a single HTTP/3 attempt alongside TCP when neither
Alt-Svc nor an HTTPS DNS record signals HTTP/3 support.

The optimistic attempt is carried to Http3Session via the new
NS_HTTP_OPTIMISTIC_HTTP3 caps bit and configures neqo to send a single
handshake flight only, giving up at the first PTO if the server does
not respond. A failed optimistic attempt does not exclude HTTP/3 for
the origin.

Adds the happy_eyeballs_h3_attempt_outcome labeled counter, recording
whether each HTTP/3 attempt succeeded, failed or was cancelled, and
which signal it had: none (optimistic), alt_svc, https_rr or both.
Adds an "optimistic" field to the Happy Eyeballs connection profiler
marker and an "optimistic_quic" field to its lifetime marker, and logs
optimistic attempts in HappyEyeballsConnectionAttempt and Http3Session.

Vendors neqo from mxinden-bot/neqo f654e68, i.e. v0.35.0 plus
ConnectionParameters::single_handshake_flight from
mozilla/neqo#4401, and happy-eyeballs from
mozilla/happy-eyeballs#167 (d54b14d). mtu is
unchanged from v0.35.0; its audit is extended to the new rev.
mxinden-bot pushed a commit to mxinden-bot/firefox that referenced this pull request Nov 21, 2026
Behind network.http.http3.optimistic_quic (default true), Happy
Eyeballs races a single HTTP/3 attempt alongside TCP when neither
Alt-Svc nor an HTTPS DNS record signals HTTP/3 support.

The optimistic attempt is carried to Http3Session via the new
NS_HTTP_OPTIMISTIC_HTTP3 caps bit and configures neqo to send a single
handshake flight only, giving up at the first PTO if the server does
not respond. A failed optimistic attempt does not exclude HTTP/3 for
the origin.

Optimistic HTTP/3 applies only to direct connections to https origins,
not via a proxy, as HTTP/3 needs TLS (RFC 9114, Section 3.1.2).

Adds the happy_eyeballs_h3_attempt_outcome labeled counter, recording
whether each HTTP/3 attempt succeeded, failed or was cancelled, and
which signal it had: optimistic (none), alt_svc, https_rr or both. It
also records optimistic_opted_out when a site's Alt-Svc or HTTPS record
without HTTP/3 prevented the optimistic attempt.
Adds an "optimistic" field to the Happy Eyeballs connection profiler
marker and an "optimistic_quic" field to its lifetime marker, and logs
optimistic attempts in HappyEyeballsConnectionAttempt and Http3Session.

Vendors neqo from mxinden-bot/neqo f654e68, i.e. v0.35.0 plus
ConnectionParameters::single_handshake_flight from
mozilla/neqo#4401, and happy-eyeballs from
mozilla/happy-eyeballs#167 (d54b14d). mtu is
unchanged from v0.35.0; its audit is extended to the new rev.
mxinden-bot pushed a commit to mxinden-bot/firefox that referenced this pull request Nov 21, 2026
Behind network.http.http3.optimistic_quic (default true), Happy
Eyeballs races a single HTTP/3 attempt alongside TCP when neither
Alt-Svc nor an HTTPS DNS record signals HTTP/3 support.

The optimistic attempt is carried to Http3Session via the new
NS_HTTP_OPTIMISTIC_HTTP3 caps bit and configures neqo to send a single
handshake flight only, giving up at the first PTO if the server does
not respond. A failed optimistic attempt does not exclude HTTP/3 for
the origin.

Optimistic HTTP/3 applies only to direct connections to https origins,
not via a proxy, as HTTP/3 needs TLS (RFC 9114, Section 3.1.2).

Adds the happy_eyeballs_h3_attempt_outcome labeled counter, recording
whether each HTTP/3 attempt succeeded, failed or was cancelled, and
which signal it had: optimistic (none), alt_svc, https_rr or both. It
also records optimistic_opted_out when a site's Alt-Svc or HTTPS record
without HTTP/3 prevented the optimistic attempt.
Adds an "optimistic" field to the Happy Eyeballs connection profiler
marker and an "optimistic_quic" field to its lifetime marker, and logs
optimistic attempts in HappyEyeballsConnectionAttempt and Http3Session.

Vendors neqo from mxinden-bot/neqo f654e68, i.e. v0.35.0 plus
ConnectionParameters::single_handshake_flight from
mozilla/neqo#4401, and happy-eyeballs from
mozilla/happy-eyeballs#167 (d54b14d). mtu is
unchanged from v0.35.0; its audit is extended to the new rev.
mxinden-bot pushed a commit to mxinden-bot/firefox that referenced this pull request Nov 21, 2026
Behind network.http.http3.optimistic_quic (default true), Happy
Eyeballs races a single HTTP/3 attempt alongside TCP when neither
Alt-Svc nor an HTTPS DNS record signals HTTP/3 support.

The optimistic attempt is carried to Http3Session via the new
NS_HTTP_OPTIMISTIC_HTTP3 caps bit and configures neqo to send a single
handshake flight only, giving up at the first PTO if the server does
not respond. A failed optimistic attempt does not exclude HTTP/3 for
the origin.

Optimistic HTTP/3 applies only to direct connections to https origins,
not via a proxy, as HTTP/3 needs TLS (RFC 9114, Section 3.1.2).

Adds the happy_eyeballs_h3_attempt_outcome labeled counter, recording
whether each HTTP/3 attempt succeeded, failed or was cancelled, and
which signal it had: optimistic (none), alt_svc, https_rr or both. It
also records optimistic_opted_out when a site's Alt-Svc or HTTPS record
without HTTP/3 prevented the optimistic attempt.
Adds an "optimistic" field to the Happy Eyeballs connection profiler
marker and an "optimistic_quic" field to its lifetime marker, and logs
optimistic attempts in HappyEyeballsConnectionAttempt and Http3Session.

Vendors neqo from mxinden-bot/neqo f654e68, i.e. v0.35.0 plus
ConnectionParameters::single_handshake_flight from
mozilla/neqo#4401, and happy-eyeballs from
mozilla/happy-eyeballs#167 (d54b14d). mtu is
unchanged from v0.35.0; its audit is extended to the new rev.
assert!(client.process_output(now).dgram().is_some());
assert!(client.process_output(now).dgram().is_some());

// The pacing timer, then the PTO.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you expecting pacing, when nothing follows that?

@martinthomson martinthomson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature seems reasonable (we're going to miss some opportunities with packet loss, but whatever...) Some suggestions though.

&& self.role == Role::Client
&& self.state == State::WaitInitial
&& !matches!(self.address_validation, AddressValidationInfo::Retry { .. })
&& !self.server_packet_before_initial

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the length of this check. I'd recommend a new state for this: SingleFlightSent, which would encapsulate a lot of these checks. There is no case I'm aware of where the server gets to interrupt that flight with something that would disable the feature, so this is safe.

Then, receipt of any(*) packet from the server would flip the client into a new state and you wouldn't need to check so many things here.

&& self.cid_manager.is_valid(packet.dcid())
&& !self.saved_datagrams.is_either_full()
=> {
self.server_packet_before_initial = true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where I think a new state saves you. Receiving a packet in that state (even an unvalidated one) flips the state back to the normal path.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants